<include file="Public/header" /> 
<script type="text/javascript" src="__PUBLIC__/js/uploadify/jquery.uploadify.min.js"></script>
<!--主窗体-->
<div class="container app">
	<!--左侧菜单-->
	<include file="Public/sidebar" /> 
	<!--左侧菜单//-->
	
	<!-- mainCon -->
	<div id="mainCon" class="mainCon">
		<h4>站点设置</h4>
		<div class="bs-example-bg-classes">
			<p class="bg-warning">
			说明：公告设置可在手机端首页设置功能介绍、使用手册、推广等信息。<br>
				  文章发布底部图片设置了图片后，只有非正式会员才会出现底部图片。
			</p>
		</div>
		<form class="form-horizontal" id="myform">
		
			<!-- <div class="form-group">
				<label for="" class="col-sm-2 control-label">首页顶部展示图片</label>
				<div class="col-sm-5">
					<div class="upload-file-box" style="width:350px">
						<div class="radio col-sm-5">
							<a class="btn btn-default" id="uploadify">上传图片</a> <span style="margin-top:10px;float:left;color:#999">（仅允许上传1MB以内的图片）</span>
						</div>
						<div id="upload-file-view" class="OneImageBox upload-view">
							<div id="showimg">
						
							<if condition="!empty($result['banner_picture'])">
								<div style="width:100px;height:100px;border:1px solid #ccc;overflow:hidden;float:left;">
									<img src="<{$result['banner_picture']}>" style="width:100px;height:100px;float:left;margin:0 auto;padding:5px;">
									<div onclick="removeImg();" style="height:30px;width:100%;background:#000;opacity:.6;text-align:center;z-index:3;position:relative;bottom:30px;color:#fff;line-height:30px;float:left;cursor:pointer;">删除</div>
								</div>
							</if>
							</div>
							<input type="hidden" id="banner_picture" name="banner_picture" value="<{$result['banner_picture']}>"/>
						</div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label for="banner_picture_url" class="col-sm-2 control-label">首页顶部图片链接</label>
				<div class="col-sm-5">
					<input type="text" class="form-control" name="banner_picture_url" id="banner_picture_url" value="<{$result['banner_picture_url']}>" placeholder="首页图片链接">
				</div>
			</div>
			 -->
			
			<div class="form-group">
				<label for="" class="col-sm-2 control-label">首页中部展示图片</label>
				<div class="col-sm-5">
					<div class="upload-file-box" style="width:350px">
						<div class="radio col-sm-5">
							<a class="btn btn-default" id="uploadify_two">上传图片</a> <span style="margin-top:10px;float:left;color:#999">（仅允许上传1MB以内的图片）</span>
						</div>
						<div id="upload-file-view" class="OneImageBox upload-view">
							<div id="showimg_two">
						
							<if condition="!empty($result['banner_picture_two'])">
								<div style="width:100px;height:100px;border:1px solid #ccc;overflow:hidden;float:left;">
									<img src="<{$result['banner_picture_two']}>" style="width:100px;height:100px;float:left;margin:0 auto;padding:5px;">
									<div onclick="removeImg_two();" style="height:30px;width:100%;background:#000;opacity:.6;text-align:center;z-index:3;position:relative;bottom:30px;color:#fff;line-height:30px;float:left;cursor:pointer;">删除</div>
								</div>
							</if>
							</div>
							<input type="hidden" id="banner_picture_two" name="banner_picture_two" value="<{$result['banner_picture_two']}>"/>
						</div>
					</div>
				</div>
			</div>
			
			<div class="form-group">
				<label for="" class="col-sm-2 control-label">文章发布底部图片</label>
				<div class="col-sm-5">
					<div class="upload-file-box" style="width:350px">
						<div class="radio col-sm-5">
							<a class="btn btn-default" id="uploadify_three">上传图片</a> <span style="margin-top:10px;float:left;color:#999">（仅允许上传1MB以内的图片）</span>
						</div>
						<div id="upload-file-view" class="OneImageBox upload-view">
							<div id="showimg_three">
						
							<if condition="!empty($result['publish_picture'])">
								<div style="width:100px;height:100px;border:1px solid #ccc;overflow:hidden;float:left;">
									<img src="<{$result['publish_picture']}>" style="width:100px;height:100px;float:left;margin:0 auto;padding:5px;">
									<div onclick="removeImg_three();" style="height:30px;width:100%;background:#000;opacity:.6;text-align:center;z-index:3;position:relative;bottom:30px;color:#fff;line-height:30px;float:left;cursor:pointer;">删除</div>
								</div>
							</if>
							</div>
							<input type="hidden" id="publish_picture" name="publish_picture" value="<{$result['publish_picture']}>"/>
						</div>
					</div>
				</div>
			</div>
			
			
		
			<div class="form-group">
				<label for="" class="col-sm-2 control-label">公告1</label>
				<div class="col-sm-5">
					<textarea name="notice_one" id="notice_one" cols="30" rows="10">
						<{$result['notice_one']}>
					</textarea>
					<{:A('Editor')->buildEditor('notice_one');}>
				</div>
			</div>

			<div class="form-group">
				<label for="" class="col-sm-2 control-label">公告2</label>
				<div class="col-sm-5">
					<textarea name="notice_two" id="notice_two" cols="30" rows="10">
						<{$result['notice_two']}>
					</textarea>
					<{:A('Editor')->buildEditor('notice_two');}>
				</div>
			</div>
			
			
			<div class="form-group">
				<label for="" class="col-sm-2 control-label">公告3</label>
				<div class="col-sm-5">
					<textarea name="notice_three" id="notice_three" cols="30" rows="10">
						<{$result['notice_three']}>
					</textarea>
					<{:A('Editor')->buildEditor('notice_three');}>
				</div>
			</div>
			
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-default col-sm-2">保存</button>
				</div>
			</div>
		</form>
	</div>
	<!-- mainCon// -->
	
</div>
<!--主窗体//-->

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script src="__PUBLIC__/js/validate/jquery.validate.min.js"></script>
<script src="__PUBLIC__/js/validate/messages_zh.js"></script>
<script>
$(function(){
	$("#myform").validate({
		rules : {

		},
		messages : {

		},
		submitHandler : function(form){
			var ajaxUrl = "<{:U('Admin/Option/ajax_notice')}>";
			 $.post(ajaxUrl,$(form).serialize(),function(r){
    			if(r.error == 1){
    				layer.alert(r.msg,{icon: 2});
    			}else{
    				layer.alert(r.msg,{icon: 1},function(){
    					window.location.href = "<{:U('Admin/Option/notice',array('k'=>6,'sk'=>7))}>";
    				});
    			}
    			return false;
    		});
        	return false
		}
	});

	$('#seo_key').focus(function() {
		var index = layer.tips('用逗号[英文半角]分隔,字数推荐20字以内',"#seo_key",{time:0});
		$(this).blur(function() {
			layer.close(index);
		});
	});

	$('#seo_depict').focus(function() {
		var index = layer.tips('字数推荐150字以内',"#seo_depict",{time:0});
		$(this).blur(function() {
			layer.close(index);
		});
	});
	
	
	// 文件上传(首页顶部)
	$("#uploadify").uploadify({
	//	'formData': {"uptype":"cate"},
		'swf'           : '/Public/js/uploadify/uploadify.swf',
		'uploader'      : "<?php echo U('Admin/Gallery/uploadImg');?>",
		'fileTypeExts'	: '*.jpg;*.png;*.gif',
		'width'			: 90,
		'buttonText' : '<a class="btn btn-default" id="uploadify">上传图片</a>',
		'hideButton' : true,
		'multi': false,
		'fileObjName' : 'imgFile',
		'fileSizeLimit' : '1MB',
		'onUploadError' : function(back) {
			
		},
		'onUploadStart' : function(file) {

    	},
		'onUploadSuccess' : function(file,data,response) {
			var r = jQuery.parseJSON(data);
			if(r.error == 0){
				var htm = '<div style="width:100px;height:100px;border:1px solid #ccc;overflow:hidden;float:left;">';
				htm += '<img src="/'+r.imgUrl+'" style="width:100px;height:100px;float:left;margin:0 auto;padding:5px;">';
				htm += '<div onclick="removeImg();" style="height:30px;width:100%;background:#000;opacity:.6;text-align:center;z-index:3;position:relative;bottom:30px;color:#fff;line-height:30px;float:left;cursor:pointer;">删除</div>';
				htm += '</div>';
				$('#showimg').html('');
				$("#showimg").append(htm);
				$("#banner_picture").val("/"+r.imgUrl+"");
			}
		},
	});
	
	
	// 文件上传(首页中部)
	$("#uploadify_two").uploadify({
	//	'formData': {"uptype":"cate"},
		'swf'           : '/Public/js/uploadify/uploadify.swf',
		'uploader'      : "<?php echo U('Admin/Gallery/uploadImg');?>",
		'fileTypeExts'	: '*.jpg;*.png;*.gif',
		'width'			: 90,
		'buttonText' : '<a class="btn btn-default" id="uploadify_two">上传图片</a>',
		'hideButton' : true,
		'multi': false,
		'fileObjName' : 'imgFile',
		'fileSizeLimit' : '1MB',
		'onUploadError' : function(back) {
			
		},
		'onUploadStart' : function(file) {

    	},
		'onUploadSuccess' : function(file,data,response) {
			var r = jQuery.parseJSON(data);
			if(r.error == 0){
				var htm = '<div style="width:100px;height:100px;border:1px solid #ccc;overflow:hidden;float:left;">';
				htm += '<img src="/'+r.imgUrl+'" style="width:100px;height:100px;float:left;margin:0 auto;padding:5px;">';
				htm += '<div onclick="removeImg_two();" style="height:30px;width:100%;background:#000;opacity:.6;text-align:center;z-index:3;position:relative;bottom:30px;color:#fff;line-height:30px;float:left;cursor:pointer;">删除</div>';
				htm += '</div>';
				$('#showimg_two').html('');
				$("#showimg_two").append(htm);
				$("#banner_picture_two").val("/"+r.imgUrl+"");
			}
		},
	});
	
	
	// 文件上传(文章发布底部图片)
	$("#uploadify_three").uploadify({
	//	'formData': {"uptype":"cate"},
		'swf'           : '/Public/js/uploadify/uploadify.swf',
		'uploader'      : "<?php echo U('Admin/Gallery/uploadImg');?>",
		'fileTypeExts'	: '*.jpg;*.png;*.gif',
		'width'			: 90,
		'buttonText' : '<a class="btn btn-default" id="uploadify_three">上传图片</a>',
		'hideButton' : true,
		'multi': false,
		'fileObjName' : 'imgFile',
		'fileSizeLimit' : '1MB',
		'onUploadError' : function(back) {
			
		},
		'onUploadStart' : function(file) {

    	},
		'onUploadSuccess' : function(file,data,response) {
			var r = jQuery.parseJSON(data);
			if(r.error == 0){
				var htm = '<div style="width:100px;height:100px;border:1px solid #ccc;overflow:hidden;float:left;">';
				htm += '<img src="/'+r.imgUrl+'" style="width:100px;height:100px;float:left;margin:0 auto;padding:5px;">';
				htm += '<div onclick="removeImg_three();" style="height:30px;width:100%;background:#000;opacity:.6;text-align:center;z-index:3;position:relative;bottom:30px;color:#fff;line-height:30px;float:left;cursor:pointer;">删除</div>';
				htm += '</div>';
				$('#showimg_three').html('');
				$("#showimg_three").append(htm);
				$("#publish_picture").val("/"+r.imgUrl+"");
			}
		},
	});
	
	
});
//移除图片
	function removeImg(){
		$("#showimg").html('');
		$("#banner_picture").val('');
	}
	
	function removeImg_two(){
		$("#showimg_two").html('');
		$("#banner_picture_two").val('');
	}
	
	function removeImg_three(){
		$("#showimg_three").html('');
		$("#publish_picture").val('');
	}
</script>

<include file="Public/footer" /> 